<?php
/**
 * User: @lose
 * Date: 2019-09-29
 * Time: 18:17
 */

namespace Biz\model;

use Doraemon\pockets\datebase\BaseDbModel;

class CategoryStatusMap extends BaseDbModel
{
    const _CONFIG_FILE_ = 'db_shop';

    const _CONFIG_SELECT_ = 'db_shop';

    const _DATABASE_ = 'shop';

    const _TABLE_NAME = 'category_status_map';

    const STATUS_NORMAL = 1;
    const STATUS_HIDE = 2;
    const STATUS_DELETE = 9;

    const TYPE_STATUS_DECORATION = 1; // 装修状态
    const TYPE_STATUS_HOUSE = 2; // 房屋状态

    const TYPE_STATUS = [
        self::TYPE_STATUS_DECORATION,
        self::TYPE_STATUS_HOUSE
    ];

    const DECORATION_STATUS_READY = 1;
    const DECORATION_STATUS_ING = 2;
    const DECORATION_STATUS_NO_NEED = 3;

    const DECORATION_STATUS_DESC = [
        self::DECORATION_STATUS_READY => '准备装修',
        self::DECORATION_STATUS_ING => '正在装修',
        self::DECORATION_STATUS_NO_NEED => '不需要装修'
    ];

    const HOUSE_STATUS_FINE = 1;
    const HOUSE_STATUS_BLANK = 2;
    const HOUSE_STATUS_SECOND_HAND = 3;
    const HOUSE_STATUS_NO_CHOOSE = 4;

    const HOUSE_STATUS = [
        self::HOUSE_STATUS_FINE => '精装房',
        self::HOUSE_STATUS_BLANK => '毛坯房',
        self::HOUSE_STATUS_SECOND_HAND => '老房重装',
        self::HOUSE_STATUS_NO_CHOOSE => '未填写',
    ];

    public static function getInfoByCategoryId($categoryId)
    {
        return self::select('*', ['category_id' => $categoryId, 'recommend_status' => self::STATUS_NORMAL]);
    }
}